package com.jumper.cwolf.test;

import cn.hutool.core.math.MathUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class LiuHe {

    static int zz = 0;
    static int zt = 0;
    public static void main(String[] args) {
        for (int i = 0; i < 10000000; i++) {
//            ThreadUtil.sleep(1);
            int[] ints = getOne();
            boolean zhong = isZhong1(ints);
            boolean zhongT = isZhongT(ints);
            System.out.println(JSONUtil.toJsonStr(ints)+zhong);
            if(zhong){
                zz++;
            }
            if(zhongT){
                zt++;
            }
        }
        System.out.println("zz:"+zz);
        System.out.println("zt:"+zt);

    }



    public static int[] getOne(){
        int[] ints = new int[7];
        ArrayList<Integer> all = new ArrayList<>();
        for (int i = 0; i < 48; i++) {
            all.add(i+1);
        }
        for (int i = 0; i < 7; i++) {
            int randomInt = RandomUtil.randomInt(48-i);
            ints[i] = all.get(randomInt);
            all.remove(randomInt);
        }
        return ints;
    }


    public static boolean isZhong(int[] hao){
        int x1 = 1;
        int x2 = 1;
        int x3 = 1;
        for (int i = 0; i < hao.length; i++) {
            int cur = hao[i];
            if(cur<=4){
                x1 = 0;
            }else
            if(cur<=8){
                x2 = 0;
            }else if(cur<=12){
                x3 = 0 ;
            }

        }
        return x1==0 && x2==0 && x3==0;

    }

    public static boolean isZhong1(int[] hao){
        int x1 = 1;
        int x2 = 1;
        int x3 = 1;
        for (int i = 0; i < hao.length; i++) {
            int cur = hao[i];
            if(cur%12==4){
                x1 = 0;
            }
            if(cur%12==1){
                x2 = 0;
            }
            if(cur%12==7){
                x3 = 0 ;
            }

        }
        return x1==0 && x2==0 && x3==0;

    }

    public static boolean isZhongP(int[] hao){
        int x1 = 1;
        int x2 = 1;
        int x3 = 1;
        for (int i = 0; i < hao.length; i++) {
            int cur = hao[i];
            if(cur<=4){
                x1 = 0;
            }else
            if(cur<=8){
                x2 = 0;
            }else if(cur<=12){
                x3 = 0 ;
            }

        }
        return x1==0 && x2==0 && x3==0;

    }

    public static boolean isZhongT(int[] hao){
        int x1 = 16;
        return (hao[6]==x1);

    }

}
